package org.pp;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.pp.core.AdminConstants;
import org.pp.entity.SysRoleMenu;
import org.pp.service.ISysMenuService;
import org.pp.service.ISysRoleMenuService;
import org.pp.service.ISysRoleService;
import org.pp.util.RedisUtil;
import org.pp.vo.AdminMenuTreeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
@Slf4j
public class AppInit implements CommandLineRunner {

    @Autowired
    ISysRoleService roleService;
    @Autowired
    ISysRoleMenuService roleMenuService;

    @Override
    public void run(String... args) throws Exception {
        log.info("开始初始化权限");
        List<SysRoleMenu> list = roleMenuService.list();
        roleService.refreshAuths(list);
        log.info("初始化权限结束");
    }



}
